<?php $json_arr = $sf_data->getRaw('json_arr'); ?>
<?php $key = "AIzaSyB5NDUuxqQcL2VYUp3G1qn_knSXAiCIXSI"; ?>
<div style="clear:both">
<?php
$i = 1;
foreach ($json_arr as $json){
	$data = $json["result"];
	?>
		<?php 
		if (array_key_exists('formatted_address', $data)){
			?>	
	<div style="float:left; padding:5px; margin:15px; width: 20%; overflow: hidden;">
		<div style="height: 150px; margin-bottom: 5px;">
	<?php 
		$photos = array_key_exists("photos", $data) ? $data["photos"] : array();
		if (count($photos) > 0){
			$places_photo_url = "https://maps.googleapis.com/maps/api/place/photo?maxwidth=200&photoreference=" . $photos[0]["photo_reference"] . "&sensor=true&key=" . $key;
			?>
			<img style="height: 150px; overflow: hidden;" src = "<?php echo $places_photo_url ?>">
			<?php 
		}
		else{ ?>
			<img  src = "<?php echo image_path("places_no_img.png")?>">
			<?php 
		}
		?>	
		</div>
		<div><?php echo $data["name"] ?></div>
		<div><?php echo $data["formatted_address"] ?></div>

		<!--	<div><?php echo $data["formatted_phone_number"] ?></div> -->
		</div>
	<?php
	if ($i % 4 == 0){
		?>
		<div style="clear:both;"></div>
		<?php 
	}
	$i++; 		
 }
}
?>
<?php if (count($json_arr) > 0){
?>
<div style="clear: both; text-align: right;">
<img src="<?php echo image_path("powered-by-google-on-white.png")?>" />
</div>
<?php 
}?>
</div>